<?php

(new class {
    public function test(){
        echo "ok";
    }
})->test();

(function(){
    echo "test2";
})();